<div class="form">

<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'insurance-form',
	'enableAjaxValidation'=>false,
)); ?>

	<p class="note">Fields with <span class="required">*</span> are required.</p>

	<?php echo $form->errorSummary($model); ?>
	
	<?php if(Yii::app()->user->role=="client"){ ?>
	<div class="row">
		<!--?php echo $form->labelEx($model,'client_id'); ?-->
		<?php echo $form->hiddenField($model,'client_id', array('value'=>Yii::app()->user->id)); ?>
		<?php echo $form->error($model,'client_id'); ?>
	</div>
	<?php }else{ ?>
	<div class="row">
		<?php echo $form->labelEx($model,'client_id'); ?>
		<?php echo $form->dropDownList($model,'client_id', $model->getClients()); ?>
		<?php echo $form->error($model,'client_id'); ?>
	</div>	
	<?php } ?>
	
	<div class="row">
		<?php echo $form->labelEx($model,'insurance_type_id'); ?>
		<?php echo $form->dropDownList($model,'insurance_type_id', $model->getInsuranceType()); ?>
		<?php echo $form->error($model,'insurance_type_id'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'policynum'); ?>
		<?php echo $form->textField($model,'policynum',array('size'=>20,'maxlength'=>20)); ?>
		<?php echo $form->error($model,'policynum'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'policy_dateissued'); ?>
		<!--?php echo $form->textField($model,'policy_dateissued'); ?-->
		<?php $this->widget('zii.widgets.jui.CJuiDatePicker', array(
		'name'=>'LeaveSummary[policy_dateissued]', // LeaveSummary (Model) , LS_FROM (Attribute) 
		'model'=>$model,
		'attribute'=>'policy_dateissued',
		// additional javascript options for the date picker plugin
		'options'=>array(
		'showAnim'=>'fold',
		'changeMonth'=>true,
		'changeYear'=>true,
		'yearRange'=>'1800:$arrYears', 
		'mode'=>'datetime',
		'dateFormat'=>'yy-mm-dd',
        'yearRange'=>'1900:2090',
		'debug'=>true,
		'showOn'=>'button',
		'buttonImage'=>Yii::app()->request->baseUrl.'/images/calendar.png',
		'buttonImageOnly'=>true,
		),
		'htmlOptions'=>array(
		'style'=>'margin:1px;height:20px;',
		'placeholder'=>'Click to select date',
		),
		));	
		?>
		<?php echo $form->error($model,'policy_dateissued'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'policy_dateexp'); ?>
		<!--?php echo $form->textField($model,'policy_dateexp'); ?-->
		<?php $this->widget('zii.widgets.jui.CJuiDatePicker', array(
		'name'=>'LeaveSummary[policy_dateexp]', // LeaveSummary (Model) , LS_FROM (Attribute) 
		'model'=>$model,
		'attribute'=>'policy_dateexp',
		// additional javascript options for the date picker plugin
		'options'=>array(
		'showAnim'=>'fold',
		'changeMonth'=>true,
		'changeYear'=>true,
		'yearRange'=>'1800:$arrYears', 
		'mode'=>'datetime',
		'dateFormat'=>'yy-mm-dd',
        'yearRange'=>'1900:2090',
		'debug'=>true,
		'showOn'=>'button',
		'buttonImage'=>Yii::app()->request->baseUrl.'/images/calendar.png',
		'buttonImageOnly'=>true,
		),
		'htmlOptions'=>array(
		'style'=>'margin:1px;height:20px;',
		'placeholder'=>'Click to select date',
		),
		));	
		?>
		<?php echo $form->error($model,'policy_dateexp'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'insurance_company_id'); ?>
		<?php echo $form->dropDownList($model,'insurance_company_id', $model->getInsuranceCo()); ?>
		<?php echo $form->error($model,'insurance_company_id'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'insureditems'); ?>
		<?php echo $form->textField($model,'insureditems',array('size'=>45,'maxlength'=>45)); ?>
		<?php echo $form->error($model,'insureditems'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'termprice'); ?>
		<?php echo $form->textField($model,'termprice',array('size'=>8,'maxlength'=>8)); ?>
		<?php echo $form->error($model,'termprice'); ?>
	</div>

	<div class="row">
		<?php echo $form->labelEx($model,'policy_coverage'); ?>
		<?php echo $form->textField($model,'policy_coverage',array('size'=>45,'maxlength'=>45)); ?>
		<?php echo $form->error($model,'policy_coverage'); ?>
	</div>
<!--
	<div class="row">
		<?php echo $form->labelEx($model,'attachment'); ?>
		<?php echo $form->textField($model,'attachment',array('size'=>60,'maxlength'=>200)); ?>
		<?php echo $form->error($model,'attachment'); ?>
	</div>
-->
	<div class="row buttons">
		<?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>
	</div>

<?php $this->endWidget(); ?>

</div><!-- form -->